<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>绩效考核  <{$smarty.const.WEB_NAME}></title>
	<link rel="stylesheet" type="text/css" href="./skin/default/style.css" />
	<script type="text/javascript" src="./skin/default/comm.js"></script> 
	<script type="text/javascript" src="./skin/default/calendar.js"></script>
</HEAD>

<BODY>
	<table>
		<tr>
			<th align="center"><{$year}>年<{$month}>月突出贡献</th>
		</tr>
	</table>
	<table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="width:100%">
		<tr>
			<td align="center" width="4%">员工</td>
			<td align="center" width="5%">价值评估</td>
			<td align="center" width="5%">是否采纳</td>
			<td align="center" width="3%">积分</td>
			<td align="center" width="50%">事项描述</td>
			<td align="center" width="33%">评价</td>
		</tr>
		<{section name=i loop=$list}>
		<tr>
			<td align="center"><{$list[i].name}></td>
		<{if $smarty.session.type == 1}>
			<td align="center" onclick="javascript:OnValuation(<{$list[i].id}>,<{$list[i].valuation}>)"><{$list[i].valuation}></td>
		<{else}>
			<td align="center"><{$list[i].valuation}></td>
		<{/if}>
			<td align="center">
				<{if $list[i].accept == 1}>是<{else}>否<{/if}>
			</td>
			<td align="center"><{$list[i].score}></td>
			<td align="left">
			<{if $list[i].userId == $smarty.session.id}>
				<a href="#" onclick="javascript:OnEditContent(<{$list[i].id}>, this)"><{$list[i].content}></a>
			<{else}>
				<{$list[i].content}>
			<{/if}>
			</td>
		<{if $smarty.session.type == 1}>
			<td align="left" onclick="javascript:OnComment(<{$list[i].id}>, this)"><{$list[i].comment}></td>
		<{else}>
			<td align="left" ><{$list[i].comment}></td>
		<{/if}>
		</tr>
		<{/section}>
	</table>

	<table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug">
	<form method="post" id="queryId" onsubmit="return OnCheck()" action="?q=kpiManage/">
		<tr>
		  <td align="center" width="20%">
		  	<a href="#" onclick="javascript:NewContribution()">新建</a>
		  </td>
		  <td align="center" width="40%"> 
			<input type="text" width="4" id="yearId" name="year" value="<{$year}>" />
			<input type="text" width="2" id="monthId" name="month" value="<{$month}>" />
			<input type="submit" value="指定查询" class="sub_btn" onclick="javascript:OnCurrQuery()"/>
		  </td>
		  <td align="center" width="20%">
			<input type="submit" value="查询上月" class="sub_btn" onclick="javascript:OnPrevQuery()"/>
			<input type="submit" value="查询下月" class="sub_btn" onclick="javascript:OnNextQuery()"/>
		  </td>
		  <td align="center" width="20%">
			<input type="button" value="导出记录" class="sub_btn" onclick="javascript:OnExport()"/>
		  </td>
		</tr>
	</form>
	</table>
	
	<table id="eContentId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:800px; line-height: 80px; left:150px; top:50px">
		<form method="post" id="eContentFormId" onsubmit="return OnCheckEditContent()" action="?q=kpiManage/EditContrContent">	
		 <tr class="tit">
		   <th align="center" colspan="2">编辑突出贡献</th>
		   <input type="hidden" name="id" id='eContrId' value="" />
		 </tr>
		 <tr>
			<td width="120" align="center">事项描述</td>
			<td height="200px">
				<textarea name="content" id="contentId" style="margin-left:20px; width:700px; height:200px; border:none; padding:6px; overflow:auto">
				</textarea>
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenEditContent()" class="submit"/>
			</td>
		 </tr>
		</form>
    </table>
    
    <table id="eCommentId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:800px; line-height: 80px; left:150px; top:50px">
		<form method="post" id="eCommentFormId" onsubmit="return OnCheckEditComment()" action="?q=kpiManage/EditContrComment">	
		 <tr class="tit">
		   <th align="center" colspan="2">编辑突出贡献</th>
		   <input type="hidden" name="id" id='eContrId1' value="" />
		 </tr>
		 <tr>
			<td width="120" align="center">评价</td>
			<td height="200px">
				<textarea name="comment" id="commentId" style="margin-left:20px; width:700px; height:200px; border:none; padding:6px; overflow:auto">
				</textarea>
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenEditComment()" class="submit"/>
			</td>
		 </tr>
		</form>
    </table>
    
    <table id="UpdateId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" id="UpdateFormId" onsubmit="return CheckUpdateVal()" action="?q=kpiManage/UpdateContrField">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="id" id='eContrId2' value="" />
		   <input type="hidden" name="colname" id='colnameId' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center" id="showId"></td>
			<td>
				<input type="text" name="colval" id="colvalId" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
    </table>

	<script type="text/javascript">
		<!--
		function OnCheck() {
			var year = $('yearId').value;
			if( year < 2011 || year > 10000 ) {
				window.alert("非法的年份!");
				return false;
			}

			var month = $('monthId').value;
			if( month < 1 || month > 12 ) {
				window.alert("非法的月份!");
				return false;
			}

			return true;
		}
		
		// 指定查询
		function OnCurrQuery() {
			$('queryId').action += "contribution";
		}
		
		// 查询上月
		function OnPrevQuery() {
			$('queryId').action += "contribution";
			var year = $('yearId').value;
			var month = $('monthId').value;
			if( month == 1 ) {
				$('yearId').value = parseInt(year, 10) - 1;
				$('monthId').value = 12;
			} else {
				$('monthId').value = parseInt(month, 10) - 1;
			}
		}
		
		// 查询下月
		function OnNextQuery() {
			$('queryId').action += "contribution";
			var year = $('yearId').value;
			var month = $('monthId').value;
			if( month == 12 ) {
				$('yearId').value = parseInt(year, 10) + 1;
				$('monthId').value = 1;
			} else {
				$('monthId').value = parseInt(month, 10) + 1;
			}
		}
		
		// 新建事项描述
		function NewContribution() {
			$('eContentId').style.display = "block";
			var v = "1、立项依据\n\n";
			v = v + "2、具体研究开发内容和要重点解决的技术关键问题\n\n";
			v = v + "3、要达到的技术效果\n\n";
			v = v + "4、项目的特色和创新之处\n\n";
			v = v + "5、采用的方法、技术路线\n\n";
			$('contentId').value = v;
		}
		
		// 检查事项描述
		function OnCheckEditContent() {
			var c = $('contentId').value;
			if( c.trim().length < 5 ) {
				window.alert( '内容太短!' );
				return false;
			}
			return true;
		}
		
		// 隐藏事项描述编辑框
		function HiddenEditContent() {
			$('eContentId').style.display = "none";
		}
		
		// 修改事项描述
		function OnEditContent(id, obj) {
			$('eContrId').value = id;
			$('contentId').value = obj.innerText;
			$('eContentId').style.display = "block";
		}
		
		// 显示修改评价
		function OnComment(id, obj) {
			$('eContrId1').value = id;
			$('commentId').value = obj.innerText;
			$('eCommentId').style.display = "block";
		}
		
		// 检查修改评价
		function OnCheckEditComment() {
			var c = $('commentId').value;
			if( c.trim().length < 5 ) {
				window.alert( '内容太短!' );
				return false;
			}
			
			var id = $('eContrId1').value;
			if( parseInt( id, 10 ) <= 0 ) {
				window.alert( '非法id<=0' );
				return false;
			}
			return true;
		}
		
		// 隐藏修改评价编辑框
		function HiddenEditComment() {
			$('eCommentId').style.display = "none";
		}
		
		// 显示价值评估
		function OnValuation(id, valuation) {
			$('showId').innerText = '价值评估';
			$('colnameId').value = 'valuation';
			OnUpdateVal(id, valuation);
		}
		
		// 显示是否采纳
		function OnAccept(id, accept) {
			$('showId').innerText = '是否采纳';
			$('colnameId').value = 'accept';
			OnUpdateVal(id, accept);
		}
		
		// 显示积分
		function OnScore(id, score) {
			$('showId').innerText = '积分';
			$('colnameId').value = 'score';
			OnUpdateVal(id, score);
		}
		
		function OnUpdateVal(id, val ) {
			$('eContrId2').value = id;
			$('colvalId').value = val;
			$('UpdateId').style.display = "block";
		}
		
		function CheckUpdateVal() {
			var v = $('colvalId').value;
			if( parseInt( v, 10 ) < 0 ) {
				window.alert( '非法值<0' );
				return false;
			}
			return true;
		}
		
		function HiddenTable() {
			$('UpdateId').style.display = "none";
		}
		//-->
	</script>
</BODY>
</HTML>